﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />

<div class="modal-dialog demo2do-modal-dialog" style="width:600px;">

  <div class="modal-content">

    <div class="modal-header beast-breadcrumb no-bottom-border clearfix">

      <h2><i class="glyphicon glyphicon-fire" title=""></i>&nbsp;&nbsp;<span>编辑广告主基本信息</span></h2>

      <button type="button" class="close" data-dismiss="modal">&times;</button>

    </div>

    <form id="base-eidt" class="form-horizontal" method="POST" action="${ctx.host}/advertisements/${advertisement.id}" data-validate="true">

      <input type="hidden" name="_method" value="PATCH"/>
      <input type="hidden" name="advertisementId" value="${advertisement.id}" >
      
      <div class="modal-body">

        <div class="form-group">
          <label class="col-xs-4 control-label">广告编号：</label>
          <div class="col-xs-4 pull-left">
            <p class="form-control-static">${advertisement.id }</p>
          </div>
        </div>
        
        <div class="form-group">
          <label class="col-xs-4 control-label">广告名称：</label>
          <div class="pull-left col-xs-6">
            <input type="text" class="form-control" name="adTitle" value="${advertisement.adTitle }" data-validate="required">
          </div>
        </div>
        
        <div class="form-group">
          <label class="col-xs-4 control-label">创建时间：</label>
          <div class="pull-left col-xs-6">
            <div class="input-group date">
              <input type="text" class="form-control" name="startDate" value="${advertisement.startDate }" readonly/>
              <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
            </div>
          </div>
        </div>
        
        <div class="form-group">
          <label class="col-xs-4 control-label">创建人：</label>
          <div class="col-xs-4 pull-left"><p class="form-control-static">${advertisement.aduser.profile.userName }</p></div>
        </div>
        
      </div>

      <div class="modal-footer">
        <button type="submit" class="btn btn-success btn-shadow btn-shadow-success demo2do-btn">确定</button>&nbsp;&nbsp;&nbsp;&nbsp;
        <button type="button" class="btn btn-default btn-shadow btn-shadow-default demo2do-btn" data-dismiss="modal">取消</button>
      </div>

    </form>

  </div>

</div>

<script src="${ctx.resource}/js/select2.min.js"></script>
<script src="${ctx.resource}/js/select2_locale_zh-CN.js"></script>
<script src="${ctx.resource}/js/bootstrap.validate.js"></script>
<script src="${ctx.resource}/js/bootstrap.validate.en.js"></script>
<script src="${ctx.resource}/js/bootstrap.validate.trigger.js"></script>

<script type="text/javascript">
  $(document).ready(function() {
	  
	  $(".date").datetimepicker({
	      format: 'yyyy-mm-dd',
	      autoclose: true,
	      language: 'zh-CN',
	      todayBtn: 'linked',
	      todayHighlight: true,
	      pickerPosition: 'bottom-left',
	      minView: 'month'
	  });
	  
    $('.select2').select2({minimumResultsForSearch: -1});
    $('form').shiftform({
    	beforeSubmit: function(el) {
        $('form').trigger("validate.ajax.submit");
	    	return $.bt_validate.result[$.bt_validate.form_id]
    	}
    });
  });
</script>